//
//  photoCollection.m
//  timemovie
//
//  Created by Yiqiao on 15/7/23.
//  Copyright (c) 2015年 Yiqiao. All rights reserved.
//

#import "photoCollection.h"
#import "photoCell.h"
@implementation photoCollection
- (id)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout{
    self = [super initWithFrame:frame collectionViewLayout:layout];
    if (self) {
        self.delegate = self;
        self.dataSource = self;
        //fenye
        self.pagingEnabled = YES;
        [self registerClass:[photoCell class] forCellWithReuseIdentifier:@"cell"];
    }
    return  self;
}

- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{
    photoCell *pCell = (photoCell*) cell;
    photoScroll *photoView = (photoScroll*)[pCell.contentView viewWithTag:100];
    photoView.zoomScale = 1;

}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return  _imageUrlArray.count;
}
- (UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    photoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    cell.imageUrl = self.imageUrlArray[indexPath.row];
    return cell;
}

- (void)setImageUrlArray:(NSArray *)imageUrlArray{
    _imageUrlArray = imageUrlArray;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
